<?php
/**
 * @project     : Travel
 * @copyright   : 
 * @desc        : Thuc hien cac thao tac tren bang hotel
 * @coder       : Truong cong quyen
 * @createdate  : 3/11/2011
*/
class Hotel_model extends CI_Model
{
    var $hotel_id=0;
    var $zone_id='';
    var $hotel_level='';
    var $hotel_name='';
    var $hotel_logo='';
    var $hotel_address='';
    var $hotel_fax='';
    var $hotel_email='';
    var $hotel_phone='';
    var $hotel_mobile='';
    var $hotel_description_vi='';
    var $hotel_description_en='';
    var $hotel_sevices_vi='';
    var $hotel_sevices_en='';
    var $hotel_image='';
    var $hotel_map='';
    var $hotel_map_descripton_vi='';
    var $hotel_map_descripton_en='';
    var $hotel_special='';
    var $hotel_is_resort='';
    var $hotel_status=1;
    

    
    public function __construct() {
        parent::__construct();
    }
    
    function get_all($status=1)
    {
        if($status!=-1)
        {
            $this->db->where('hotel_status', $status);
        }
        $query = $this->db->get('hotel');
        return $query->result();
        
    }
    
     function get_by_id($id)
    {
        $this->db->where('hotel_id', $id);
        $query = $this->db->get('hotel');
        return $query->row();
    }
    
    function get_limit($limit = 10, $offset = 0, $status = 1)
    {
        $this->db->order_by('hotel_id', 'desc');
        $this->db->where('hotel_status', $status);      
        $query = $this->db->get('hotel', $limit, $offset);        
        return $query->result();
    }
    function get_by_zone($zone_id, $offset = 0, $limit = 10)
    {
        $this->db->where('hotel_status', 1);   
        $this->db->where('zone_hotel_id',$zone_id);
        $this->db->limit($limit,$offset);   
        $query = $this->db->get('hotel', $limit, $offset);        
        return $query->result();
    }    
    function get_num_rows_by_zone($zone_id)
    {
        $this->db->where('hotel_status', 1);   
        $this->db->where('zone_hotel_id',$zone_id); 
        $query = $this->db->get('hotel');        
        return $query->num_rows();
    } 
}